#ifndef DELEWIDGET_H
#define DELEWIDGET_H

#include <QPushButton>
#include <QStyledItemDelegate>
#include <QProgressBar>
#include <QApplication>
// 自定义Button属性
class ItemButton
{
public:
    enum BUTTON_STATUS
    {
        NONE, HOVER, PRESSED, RELEASED
    };
private:
    static const int left = 10;
    static const int right = left*2;
    static const int top = 1;
    static const int button =top*2;
    QString m_buttonIconName;
    QScopedPointer<QPushButton> buttonWidget;
    BUTTON_STATUS buttonStatus = NONE;

public:
    ItemButton(QString iconName);
    void paintButton(QPainter* painter, const QStyleOptionViewItem& option, const QPoint& pos );
    //设置按钮状态，包括无状态，悬浮，按下，抬起
    void   setStatusNone();
    void   setStatusHover();
    void   setStatusPressed();
    void   setStatusReleased();
    //判断鼠标是否在按钮范围内，是就返回true，否则返回false
    static bool withinButtonRegion(const QPoint, const QStyleOptionViewItem& option);

public:


};

// 自定义ProgressBar属性
class ItemProgressBar
{
public:
    static const int left = 2;
    static const int right = left;
    static const int top = 6;
    static const int bottom = top;

private:
    QScopedPointer<QProgressBar> progressBarWidget;

public:
    ItemProgressBar();
    void paintQProgressBar(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index );

};

#endif // DELEWIDGET_H
